
using System.Data.Entity.ModelConfiguration;

namespace OBUCare.Core.Models.Mapping
{
    public class REPAIR_ORDER_ADJUSTMap : EntityTypeConfiguration<REPAIR_ORDER_ADJUST>
    {
        public REPAIR_ORDER_ADJUSTMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.COMMENT)
                .HasMaxLength(200);

            this.Property(t => t.CREATED_BY)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.MODIFY_BY)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(6);

            // Table & Column Mappings
            this.ToTable("REPAIR_ORDER_ADJUST");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.REPAIR_ORDER_ID).HasColumnName("REPAIR_ORDER_ID");
            this.Property(t => t.ADJUST_TYPE).HasColumnName("ADJUST_TYPE");
            this.Property(t => t.AMOUNT).HasColumnName("AMOUNT");
            this.Property(t => t.COMMENT).HasColumnName("COMMENT");
            this.Property(t => t.CREATED_BY).HasColumnName("CREATED_BY");
            this.Property(t => t.CREATED_DATE).HasColumnName("CREATED_DATE");
            this.Property(t => t.MODIFY_BY).HasColumnName("MODIFY_BY");
            this.Property(t => t.MODIFY_DATE).HasColumnName("MODIFY_DATE");

            // Relationships
            this.HasRequired(t => t.REPAIR_ORDERS)
                .WithMany(t => t.REPAIR_ORDER_ADJUST)
                .HasForeignKey(d => d.REPAIR_ORDER_ID);

        }
    }
}
